package shujia.day08;

/*
    把数组拼接成一个字符串

 */
public class StringBufferTest1 {
    public static void main(String[] args) {
        int[] arr = {11, 22, 33, 44};

        StringBuffer sb = new StringBuffer("[");

        for (int i = 0; i < arr.length; i++) {
            if(i==arr.length-1){
                sb.append(arr[i]).append("]");
                break;
            }
            sb.append(arr[i]).append(",");
        }

        String s1 = sb.toString();
        System.out.println(s1);
    }
}
